﻿namespace Trukuxzo.Samples.Creational.Patterns.Singleton
{
    public sealed class SingletonCounter
    {
        #region fields
        private static SingletonCounter _Instance;
        private long _Count = 0;
        #endregion

        #region propeties
        public static SingletonCounter Instance
        {
            get
            {
                if (_Instance == null)
                    _Instance = new SingletonCounter();

                return _Instance;
            }
        }
        #endregion

        #region constructor
        private SingletonCounter() { }
        #endregion

        #region functions
        public long NextValue()
        {
            return ++_Count;
        }
        #endregion
    }
}
